<template>
  <div>
        <!-- <el-form  :inline="true"   size="mini">
        <div class="search-common">
           <el-form-item label="编号" label-width="70px">
                <el-input  placeholder="请输入..."></el-input>
            </el-form-item>
             <el-form-item>
            <el-button type="primary">查询</el-button>
          </el-form-item>
        </div>
        </el-form> -->
 <div class="mt10 p10" style="background:#fff">
        <br>
  <el-table
    :data="queryList"
    size="mini"
    border
    :stripe="true"
    style="width:99%">
    <el-table-column
      prop="vesion"
      label="版本号"
    >
    </el-table-column>
    <el-table-column
      prop="memo"
      label="客户端"
     >
    </el-table-column>
    <el-table-column
      prop="hightv"
      label="大版本号"
     >
    </el-table-column>
    <el-table-column
      prop="lowv"
      label="小版本号"
    >
    </el-table-column>
<<<<<<< HEAD
=======
   

   <el-table-column
      prop="url"
      label="整体下载地址"
    >
    </el-table-column>
   
   
   <el-table-column
      prop="part_url"
      label="增量下载地址"
    >
    </el-table-column>
    <el-table-column
      prop="content"
      label="版本说明"
    >
    </el-table-column>

>>>>>>> c40d5f04d8a0e6b218a7f09b9e510e4511853fc6

    <el-table-column
      label="操作"
      width="100">
      <template slot-scope="scope">
        <el-button type="text" size="small" @click="editVersionItem(scope.row)">编辑</el-button>
      </template>
    </el-table-column>
    </el-table>
  </div>
  <!-- <div class="block tc mt15">
    <el-pagination
      @current-change="handleCurrentChange"
      :current-page.sync="page"
      :page-size="pageSize"
      layout="total, prev, pager, next"
      :total="total">
    </el-pagination>
  </div> -->



<common-dialog title="编辑" :base-dialog="baseDialog">
      <el-form :model="edie_version_dialog" :rules="rules" ref="edie_version_dialog" size="mini" label-width="120px"
               slot="body">
           <el-form-item label="客户端" prop="memo">
             <el-select v-model="edie_version_dialog.memo" disabled  >
              <el-option label="PC" value="PC"></el-option>
              <el-option label="ANDROID" value="ANDROID"></el-option>
              <el-option label="IOS" value="IOS"></el-option>
            </el-select>
        
        </el-form-item>
        <el-form-item label="版本号" prop="vesion">
          <el-input v-model="edie_version_dialog.vesion" auto-complete="off"></el-input>
        </el-form-item>
        <el-form-item label="大版本号" prop="hightv">
          <el-input v-model="edie_version_dialog.hightv" auto-complete="off"></el-input>
        </el-form-item>
        <el-form-item label="小版本号" prop="lowv">
          <el-input v-model="edie_version_dialog.lowv"  auto-complete="off"></el-input>
        </el-form-item>
          <el-form-item label="下载地址" prop="url">
          <el-input v-model="edie_version_dialog.url" auto-complete="off"></el-input>
        </el-form-item>
         <el-form-item label="增量下载地址" prop="part_url">
          <el-input v-model="edie_version_dialog.part_url"  auto-complete="off"></el-input>
        </el-form-item>
          <el-form-item label="版本说明" prop="content">
          <el-input v-model="edie_version_dialog.content" type="textarea" :rows="3" auto-complete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer tr">
        <el-button @click="baseDialog=false" size="mini">取 消</el-button>
        <el-button type="primary" size="mini" @click="editSubmit('edie_version_dialog')">确 定</el-button>
      </div>
    </common-dialog>


  </div>
</template>
<script>
import commonDialog from "@/components/Common/CommonDialog";
import service from "@/service/index_c";
export default {
  data() {
    return {
      page: 1,
      pageSize: 10,
      total: 0,
      queryList: [],
      baseDialog: false,
      edie_version_dialog: {
        id: "",
        vesion: "",
        hightv: "",
        lowv: "",
        content: "",
        url: "",
        part_url: "",
        memo: ""
      },
      rules: {
        vesion: [{ required: true, message: "请输入版本号", trigger: "blur" }],
        hightv: [{ required: true, message: "请输入大版本号", trigger: "blur" }],
        // lowv: [{ required: true, message: "请输入编号", trigger: "blur" }],
        url: [{ required: true, message: "请输入下载地址", trigger: "blur" }],
        part_url: [{ required: true, message: "请输入增量下载地址", trigger: "blur" }]
      }
    };
  },
  mounted() {
    this.queryBaseSettingList();
  },
  methods: {
    //编辑
    editVersionItem(item) {
      this.baseDialog = true;
      this.edie_version_dialog = {
        id: item.id,
        vesion: item.vesion,
        hightv: item.hightv + "",
        lowv: item.lowv + "",
        content: item.content,
        url: item.url,
        part_url: item.part_url,
        memo: item.memo
      };
    },
    //修改
    editSubmit(formName) {
      //   console.log(this.edie_version_dialog);
      this.$refs[formName].validate(valid => {
        this.editBaseSettingItem();
      });
    },
    //调去函数
    async editBaseSettingItem() {
      let res = await service.haiheiServerEidtVersion(this.edie_version_dialog);
      if (res.success) {
        this.baseDialog = false;
        this.$message({
          type: "success",
          message: res.msg
        });
        this.queryBaseSettingList();
      }
    },
    handleCurrentChange(page) {
      this.queryBaseSettingList(page);
    },
    async queryBaseSettingList(page = 1) {
      let res = await service.haiheiServerVersionList({
        page: page,
        pageSize: this.pageSize
      });
      if (res.success) {
        this.queryList = res.result.pageList;
        this.page = res.result.page;
        this.total = res.result.nums;
      }
    }
  },
  components: {
    commonDialog
  }
};
</script>

